﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="stud.aspx.cs" Inherits="aspnet_testPargrameDir_site_Member_Admin_stud" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">

    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" PageSize="30" Width="100%" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="自动编号,学号" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="更新"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="取消"></asp:LinkButton>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="编辑"></asp:LinkButton>
<%--        
                    <%#
                    //学号
                    ((System.Data.DataRowView)Container.DataItem).Row[1]
                    %>--%>
                    <asp:LinkButton ID="LinkButton2"  OnClick="LinkButton2_Click" runat="server" CommandArgument='<%#((System.Data.DataRowView)Container.DataItem).Row[1]%>'>创建会员</asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="自动编号" HeaderText="自动编号" InsertVisible="False"   SortExpression="自动编号" ReadOnly="True" />
            <asp:BoundField DataField="学号" HeaderText="会员号" SortExpression="学号" ReadOnly="True" />
            <asp:BoundField DataField="姓名" HeaderText="姓名" SortExpression="姓名" />
            <asp:BoundField DataField="联系方式" HeaderText="联系方式" SortExpression="联系方式" />
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AnboEduConnectionString %>" DeleteCommand="DELETE FROM [CX_Student] WHERE [自动编号] = @自动编号" InsertCommand="INSERT INTO [CX_Student] ([学号], [姓名], [联系方式]) VALUES (@学号, @姓名, @联系方式)" SelectCommand="SELECT * FROM [CX_Student] ORDER BY [自动编号] DESC" UpdateCommand="UPDATE [CX_Student] SET [学号] = @学号, [姓名] = @姓名, [联系方式] = @联系方式 WHERE [自动编号] = @自动编号">
        <DeleteParameters>
            <asp:Parameter Name="自动编号" Type="Decimal" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="学号" Type="Decimal" />
            <asp:Parameter Name="姓名" Type="String" />
            <asp:Parameter Name="联系方式" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="学号" Type="Decimal" />
            <asp:Parameter Name="姓名" Type="String" />
            <asp:Parameter Name="联系方式" Type="String" />
            <asp:Parameter Name="自动编号" Type="Decimal" />
        </UpdateParameters>
    </asp:SqlDataSource>
    </form>
</body>
</html>
